import sys
import hashlib
def md5(files):
    m1 = hashlib.md5()
    with open(files,'rb') as file:
        while 1:
            data = file.read(4096)
            if not data:
                break
            m1.update(data)
        file.close()

    return m1.hexdigest()
if __name__ == '__main__':
    files = sys.argv[1]
    print(md5(files))
#执行方式 md5-file /etc/passwd